//
//  ZXEmptyView.m
//  ZhiXingUser
//
//  Created by Cocoa on 2019/5/9.
//  Copyright © 2019年 QiaoLi. All rights reserved.
//

#import "ZXEmptyView.h"

@implementation ZXEmptyView

+ (ZXEmptyView *)noDataEmptyWithBtnClickBlock:(LYActionTapBlock)btnClickBlock {
//    ZXEmptyView *emptyView = [ZXEmptyView emptyViewWithImage:UIImage.k_imgName(@"emptyPlaceholder_noData") titleStr:nil detailStr:nil];
//    return emptyView;
//    UIView *contentView = UIView.new;
//
//    UIImageView *imgView = [[UIImageView alloc] initWithImage:UIImage.k_imgName(@"emptyPlaceholder_noData")];
//    UIButton *actionBtn = UIButton.k_init();
//    [contentView addSubview:imgView];
//    [contentView addSubview:actionBtn];
//    actionBtn.frame =
//    //    imgView.frame =
//    contentView.frame = CGRectMake(0, 0, ScreenWidth, ScreenWidth);
////    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
////        make.center.equalTo(contentView);
////    }];
//
//    [[actionBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
//        if (btnClickBlock) {
//            btnClickBlock();
//        }
//    }];
//    return [ZXEmptyView emptyViewWithCustomView:contentView];
    return [ZXEmptyView zxEmptyViewWithImgStr:@"emptyPlaceholder_noData" btnClickAction:btnClickBlock];
}

+ (ZXEmptyView *)networkErrorEmptyWithBtnClickBlock:(LYActionTapBlock)btnClickBlock {
//    ZXEmptyView *emptyView = [ZXEmptyView emptyActionViewWithImage:UIImage.k_imgName(@"emptyPlaceholder_network") titleStr:nil detailStr:nil btnTitleStr:nil btnClickBlock:btnClickBlock];
//    return emptyView;
//    UIImageView *imgView = [[UIImageView alloc] initWithImage:UIImage.k_imgName(@"emptyPlaceholder_network")];
//    imgView.frame = CGRectMake(0, 0, ScreenWidth, ScreenWidth);
//    return [ZXEmptyView emptyViewWithCustomView:imgView];
    return [ZXEmptyView zxEmptyViewWithImgStr:@"emptyPlaceholder_network" btnClickAction:btnClickBlock];

}
+ (ZXEmptyView *)unLoginErrorForOrder:(LYActionTapBlock)btnClickBlock {
    return [ZXEmptyView zxEmptyViewWithImgStr:@"emptyPlaceholder_loginedLookOrder" btnClickAction:btnClickBlock];

}
+ (instancetype)zxEmptyViewWithImgStr:(NSString *)imgStr btnClickAction:(LYActionTapBlock)action {
    UIView *contentView = UIView.new;
    
    UIImageView *imgView = [[UIImageView alloc] initWithImage:UIImage.k_imgName(imgStr)];
    UIButton *actionBtn = UIButton.k_init();
    [contentView addSubview:imgView];
    [contentView addSubview:actionBtn];
    actionBtn.frame =
//    imgView.frame =
    contentView.frame = CGRectMake(0, 0, ScreenWidth, ScreenWidth);
    imgView.center = contentView.center;
    
    [[actionBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        if (action) {
            action();
        }
    }];
    
    return [ZXEmptyView emptyViewWithCustomView:contentView];
}

@end
